package com.cloud.poetry.file.controller;

import com.cloud.poetry.base.entity.res.SaveFileOutParam;
import com.cloud.poetry.file.service.MiniService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author mengxj
 */
@RestController
@RequestMapping("mini")
public class MiniController {

    @Resource
    private MiniService miniService;

    @PostMapping("save")
    public SaveFileOutParam saveFile(@RequestParam("file") MultipartFile file){
        return this.miniService.saveFile(file);
    }

    @DeleteMapping("remove")
    public void removeFile(@RequestParam("bucket") String bucket, @RequestParam("objectName") String objectName){
        this.miniService.removeFile(bucket, objectName);
    }
}
